<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- 引入 layui.css -->
    <link rel="stylesheet" href="/static/layui/css/layui.css"/>
    <!-- 引入 layui.js -->
    <script src="/static/layui/layui.js"></script>
</head>
<body>
<!--<p>mmmm</p>-->
<!--<ul class="layui-nav" lay-filter="">-->
<!--    <li class="layui-nav-item"><a href="">最新活动</a></li>-->
<!--    <li class="layui-nav-item layui-this"><a href="">产品</a></li>-->
<!--    <li class="layui-nav-item"><a href="">大数据</a></li>-->
<!--    <li class="layui-nav-item">-->
<!--        <a href="javascript:;">解决方案</a>-->
<!--        <dl class="layui-nav-child"> &lt;!&ndash; 二级菜单 &ndash;&gt;-->
<!--            <dd><a href="">移动模块</a></dd>-->
<!--            <dd><a href="">后台模版</a></dd>-->
<!--            <dd><a href="">电商平台</a></dd>-->
<!--        </dl>-->
<!--    </li>-->
<!--    <li class="layui-nav-item"><a href="">社区</a></li>-->
<!--</ul>-->
<form class="layui-form" style="padding: 64px">
    <div class="layui-form-item">
        <label class="layui-form-label">账号</label>
        <div class="layui-input-block">
            <input type="text" name="mobile" required lay-verify="title" autocomplete="off" placeholder="请输入账号"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="password" name="password" required lay-verify="pass" autocomplete="off" placeholder="请输入密码"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">验证码</label>
    <div class="layui-input-block">
        <input type="text" name="captcha" required lay-verify="required" autocomplete="off" placeholder="请输入验证码"
               class="layui-input">
        <img src="{:captcha_src()}" alt="captcha"
             style="position: absolute;top: 1px;right: 1px;"/>
    </div>
    </div>
    <div class="layui-form-item">
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
    layui.use(function () {
        let form = layui.form;
        let layer = layui.layer;
        form.verify({
            title: function(value){
                if(value.length < 5){
                    return '标题至少得5个字符啊';
                }
            }
            ,pass: [
                /^[\S]{6,12}$/
                ,'密码必须6到12位，且不能出现空格'
            ]
            ,content: function(value){
                layedit.sync(editIndex);
            }
        });
        form.on('submit(demo1)', function (data) {
            if (data.field.mobile.length < 11) {
                layer.msg('手机号码格式不正确');
                return false;
            }
            if (data.field.password.length < 6) {
                layer.msg('密码长度不能低于6位');
                return false;
            }
            if (data.field.captcha.length < 4) {
                layer.msg('验证码长度不能低于4位');
                return false;
            }
            return false;
        });
    });

</script>
</body>
</html>